package com.sktlab.bizconfmobile.mina;

import com.sktlab.bizconfmobile.model.Participant;
import com.sktlab.bizconfmobile.model.manager.CommunicationManager;
import com.sktlab.bizconfmobile.util.Util;

/**
 * 
 * @author wenjuan.li
 *
 */
public class MinaPListMsg extends MinaMsg {
	

	public MinaPListMsg() {
		
		super();
	}
	
	public MinaPListMsg(String rcv) {
		
		super(rcv);
		
		generateParty();
	}
	
	/**
	 * 
	 * RX: 350~0~ACV.PL~1~1~2~
	 * 34B~wem~
	 * 34C~luo
	 */
	private void generateParty() {
		

		do {

			if (index < 7) {

				break;
			}
			
			for (int i = 7;i < index;i++) {
				
				int confIndex = (i + 1) % 2;
				
				Participant party = null;
				
				if (confIndex == 0) {
				
					party = new Participant();
					
					party.setIdInConference(tokens[i]);
					CommunicationManager.getInstance().putParty(party);
					
					//Util.BIZ_CONF_DEBUG(TAG, "add active party ID:" + tokens[i]);
				}else {
					
					party = CommunicationManager.getInstance().getActiveParties().get(tokens[i -1]);
					
					if(!Util.isEmpty(party)) {
						
						party.setName(tokens[i]);
						
						//Util.BIZ_CONF_DEBUG(TAG, "add active party name:" + tokens[i]);
					}
				}				
				
			}
				
		} while (false);

	}
}
